package pe.gob.inei.sees.controllers
{
	
	import flash.display.Sprite;
	
	import pe.gob.inei.sees.businessobjects.TemaBO;
	import pe.gob.inei.sees.events.*;
	import pe.gob.inei.sees.models.SeesModel;

	public class SeesController extends Sprite {
		
		private var model:SeesModel = SeesModel.getInstance();
		private static var instance: SeesController;//
		
		public function SeesController(singleton:SingletonEnforcer){//
		}//
		
		public static function getInstance():SeesController {
			if (SeesController.instance == null ){
				SeesController.instance = new SeesController(new SingletonEnforcer());
			}
			return SeesController.instance;
		}
		
		public function obtenerTemas():void {
			var business:TemaBO = new TemaBO();
            business.suscriptor = this;
            business.metodo = "returnHandlerTema";
            this.addEventListener("returnHandlerTema", returnHandlerTema);
			business.obtenerTemas();
		}
		
		public function returnHandlerTema(e:TemaEvent):void {
			model.listaTemas = e.temas;
		}
		
		public function getModel():SeesModel {
			return model;
		}
	}
}
class SingletonEnforcer{};//
